#!/usr/bin/env bash
db_name=dev_database
users_schema=(\
    "uid    bigint,"\
    "link   varchar(1000),"\
    "page_id    bigint,"\
    "domain     int,"\
    "nick_name  varchar(100),"\
    "num_followees  int,"\
    "num_fans       int,"\
    "num_microblogs     int,"\
    "overview       text,"\
    "tags           varchar(1000),"\
    "gender         varchar(20),"\
    "register_time  varchar(20)"\
)
user_reposts_schema=(\
    "last_uid   bigint,"\
    "last_pid   bigint,"\
    "last_domain    int,"\
    "uid        bigint,"\
    "content    text,"\
    "time       varchar(20),"\
    "original_time  varchar(20)"\
)
user_posts_schema=(\
    "uid    bigint,"\
    "content    text,"\
    "time   varchar(20)"\
)
repost_samples_schema=(\
    "last_uid   bigint,"\
    "uid        bigint,"\
    "content    text,"\
    "time       varchar(20),"\
    "is_repost  boolean"\
)
repost_samples_clean_schema=(\
    "last_uid   bigint,"\
    "uid        bigint,"\
    "content    text,"\
    "time       varchar(20),"\
    "is_repost  boolean"\
)
psql ${db_name} <<__EOF
drop table if exists users;
drop table if exists user_reposts;
drop table if exists user_posts;
drop table if exists repost_samples;
drop table if exists repost_samples_clean;
create table users (${users_schema[@]});
create table user_reposts (${user_reposts_schema[@]});
create table user_posts (${user_posts_schema[@]});
create table repost_samples (${repost_samples_schema[@]});
create table repost_samples_clean (${repost_samples_clean_schema[@]});
__EOF




